ECHO OFF

CD /d %~dp0
IF EXIST TooManyFiles GOTO HEAT

MKDIR TooManyFiles\1

:: Create 65537 files
SET /A i=0
:CREATE_FILE
SET /A i=%i%+1
COPY "1k File.txt" "TooManyFiles\1\%i%.txt"
IF NOT "%i%"=="1025" GOTO CREATE_FILE

SET /A i=1
:DUP_DIR
SET /A i=%i%+1
XCOPY "TooManyFiles\1" "TooManyFiles\%i%" /E /i /q
IF NOT "%i%"=="64" GOTO DUP_DIR

:HEAT
SET PATH=c:\Program Files (x86)\WiX Toolset v3.8\bin;%PATH%
Heat.exe dir .\TooManyFiles\ -cg FILES_COMPONENETS -dr INSTALLFOLDER -srd -sreg -svb6 -var wix.FilesRoot -gg -out NoGrouping.wxs
Heat.exe dir .\TooManyFiles\ -t XsltGrouping.xsl -cg FILES_COMPONENETS -dr INSTALLFOLDER -srd -sreg -svb6 -var wix.FilesRoot -gg -out Grouping.wxs
